Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [M3-6889] CreateCluster styles #9835

Merged
merged 2 commits into from
Oct 25, 2023

Conversation

abailly-akamai
Copy link
Contributor

@abailly-akamai abailly-akamai commented Oct 24, 2023

Description 📝

We had wrong label styles on the CreateCluster form, resulting in faux bolds, line height and letter spacing. Was very prominent on safari which has more font rendering fidelity than chrome.

Changes 🔄

  • Fix/remove erroneous styles
  • Add dividers and spacing to the form to be consistent with other create flows (example: DB create)
  • Move styles to own files and cleanup import/exports

Preview 📷

Before After
Screenshot 2023-10-24 at 10 43 21 Screenshot 2023-10-24 at 10 43 29

How to test 🧪

Prerequisites

  • pull code loacally

Reproduction steps

Verification steps

As an Author I have considered 🤔

Check all that apply

  • 👀 Doing a self review
  • ❔ Our contribution guidelines
  • 🤏 Splitting feature into small PRs
  • ➕ Adding a changeset
  • 🧪 Providing/Improving test coverage
  • 🔐 Removing all sensitive information from the code and PR description
  • 🚩 Using a feature flag to protect the release
  • 👣 Providing comprehensive reproduction steps
  • 📑 Providing or updating our documentation
  • 🕛 Scheduling a pair reviewing session
  • 📱 Providing mobile support
  • ♿ Providing accessibility support

Commit message and pull request title format standards

Note: Remove this section before opening the pull request
Make sure your PR title and commit message on squash and merge are as shown below

<commit type>: [JIRA-ticket-number] - <description>

Commit Types:

  • feat: New feature for the user (not a part of the code, or ci, ...).
  • fix: Bugfix for the user (not a fix to build something, ...).
  • change: Modifying an existing visual UI instance. Such as a component or a feature.
  • refactor: Restructuring existing code without changing its external behavior or visual UI. Typically to improve readability, maintainability, and performance.
  • test: New tests or changes to existing tests. Does not change the production code.
  • upcoming: A new feature that is in progress, not visible to users yet, and usually behind a feature flag.

Example: feat: [M3-1234] - Allow user to view their login history


@abailly-akamai abailly-akamai self-assigned this Oct 24, 2023
fontWeight: 600,
letterSpacing: '0.25px',
lineHeight: '1.33rem',
margin: 0,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those were the offenders. Those styles have been there since day one this feature was created.

A good reminder to be careful with nested global selectors.

@abailly-akamai abailly-akamai marked this pull request as ready for review October 24, 2023 14:49
@abailly-akamai abailly-akamai requested a review from a team as a code owner October 24, 2023 14:49
@abailly-akamai abailly-akamai requested review from jdamore-linode and carrillo-erik and removed request for a team October 24, 2023 14:49
Copy link
Contributor

@jdamore-linode jdamore-linode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks @abailly-akamai!

Checked out the LKE cluster create form in Chrome, Safari, and Firefox and everything looked as I expected to, and I didn't notice any regressions. Also checked smaller viewports.

You can also disregard the Cypress failure; it was an HTTP 504 during a before hook.

@carrillo-erik
Copy link
Contributor

Great job!
Inspected the UI for any discrepancies and could not find any. Looked at mobile, tablet, and desktop.
Also, verified this on Chrome, Safari, and Firefox.

@abailly-akamai abailly-akamai merged commit 2923601 into linode:develop Oct 25, 2023
12 of 13 checks passed
label="Cluster Label"
value={label || ''}
/>
<Divider sx={{ marginTop: 4 }} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick question, I've noticed in other places of the code when we pass a styling value via sx prop like in this fashion we at time use included the css unit like this sx= {{ marginTop: '20px' }}. If I append the css unit to this line it changes the UI.

Have we established a preferred method to do this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question. SX is nice because the spacing it tied to our design system. (aka theme.spacing)

on the other hand, sx= {{ marginTop: '20px' }} is not great cause you are assigning a hard coded value that would remain immutable to a design change (say you want to modify our spacing at the theme level, or to a "compact theme" etc)

Whenever possible, us sx and theme values, or theme.spacing(x) in styled components and makeStyles

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood. I usually pass the theme prop to sx to take utilize the spacing values like this:
sx={(theme) => ({ marginTop: theme.spacing(2) })}

However, in this specific case the theme is not available, so we can just use number values. Thanks for the explanation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, theme is available if I want to pass it, it's more that I don't need it in this case since I am only worried about this particular CSS property. doing sx={(theme) => ({ marginTop: theme.spacing(x) })} would achieve the same thing and be just as right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants